package action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import pojo.StaData;
import service.BackWelcomeService;
import serviceImpl.BackWelcomeServiceImpl;


@WebServlet("/BackWelcomeServlet")
public class BackWelcomeServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

    public BackWelcomeServlet() {
        super();
    }


	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		String mark = request.getParameter("mark");
		switch(mark) {
		
		case "getStaData": 
			getStaData(request,response);
			break;
		
		}
	}

	private void getStaData(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		
		BackWelcomeService bws = new BackWelcomeServiceImpl();
		StaData staData = bws.getStaData();
		request.setAttribute("staData", staData);
		request.getRequestDispatcher("/background/ordUserJs/index/welcome.jsp").forward(request, response);
		
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
	}

}
